home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Mac Magazin/MacEasy 16
/
Mac Magazin and MacEasy Magazine CD - Issue 16.iso
/
Utilities
/
Creator Changer 2.5
/
Code & Resource
/
Creator Changer.file.c
< prev
next >
Wrap
Text File
|
1995-10-20
|
3KB
|
99 lines
/**********************************************************************
* This file contains the functions which let the user determine
* which file to change the creator and/or file types.
**********************************************************************/
#include "Creator Changer.h"
#include "Creator Changer.file.h"
#include "GetFileIcon.h"
/**********************************************************************
* Function Old_File(), this function calls the file to have the
* creator and / or file type changed.
**********************************************************************/
Boolean Pick_File(FSSpec *the_file_spec, FInfo *file_info, short get_icon)
{
StandardFileReply reply;
SFTypeList my_types;
StandardGetFile(NIL_PTR, -1, my_types, &reply);
if(!reply.sfGood) return(FALSE);
else
{
*the_file_spec=reply.sfFile;
if(get_icon) GetFileIcon(the_file_spec, svAllAvailableData, &The_Icons);
FSpGetFInfo(the_file_spec, file_info);
return(TRUE);
}
}
/**********************************************************************
* Function p_Str_Copy(), this function copies one pascal string to
* another pascal string.
**********************************************************************/
void p_Str_Copy(StringPtr p1, StringPtr p2)
{
register int len;
len=*p2++=*p1++;
while(--len>=0) *p2++=*p1++;
}
/**********************************************************************
* Function Comp_The_String(), this function compares one pascal string to
* another pascal string.
**********************************************************************/
Boolean Comp_The_String(StringPtr p1, StringPtr p2)
{
register int len;
len=*p2++=*p1++;
while(--len>=0) if(*p2++!=*p1++) return(BAD);
return(GOOD);
}
/**********************************************************************
* Function Force_Finder_Update(), this function forces the Finder
* to update the window in which the file was changed in.
**********************************************************************/
void Force_Finder_Update(FSSpec *the_file_spec)
{
OSErr error;
CInfoPBRec lCBlk;
if(the_file_spec->parID!=1) lCBlk.dirInfo.ioNamePtr=0L;
lCBlk.dirInfo.ioVRefNum=the_file_spec->vRefNum;
lCBlk.dirInfo.ioDrDirID=the_file_spec->parID;
lCBlk.dirInfo.ioFDirIndex=0;
lCBlk.dirInfo.ioCompletion=0;
error=PBGetCatInfoSync(&lCBlk);
if(!error)
{
GetDateTime(&lCBlk.dirInfo.ioDrMdDat);
lCBlk.dirInfo.ioDrDirID=the_file_spec->parID;
PBSetCatInfoSync(&lCBlk);
FlushVol(NIL_PTR, the_file_spec->vRefNum);
}
}